package com.util.mail;  

import java.io.IOException;
import java.util.Date;

import org.apache.commons.configuration.Configuration;
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;

import com.util.shell.RunCmds;

public  class manSendMail {

	/**
	 * 执行 相应的命令  并
	 * 将结果发送邮件
	 * @param args
	 * @throws ConfigurationException 
	 * @throws IOException 
	 */
	public static void main(String[] args) throws ConfigurationException, IOException{   
		
		RunCmds.RunCmdLinesAndLog();
		System.out.println(".......命令执行完成..................");
		
		MailSenderInfo mailInfo = ReadFileNewObj.getMailSenderInfoProperties();
		SimpleMailSender sms = new SimpleMailSender();  
		boolean sendmailflag = false;
		sendmailflag = sms.sendTextMail(mailInfo);//发送文体格式  
		if(sendmailflag) {
			//sms.sendHtmlMail(mailInfo);//发送html格式   
			System.out.println("标题为：‘"+mailInfo.getSubject()+"’ 的邮件已在  "+new Date()+" 发送完成");
			System.out.println(".......发送邮件完成..................");
		}else{
			System.out.println("标题为：‘"+mailInfo.getSubject()+"’ 的邮件发送时产生错误，发送失败。   ---"+new Date());
		}
   }  

}
